﻿<div class="ko-app" id="~js-app-id">
    <div style="padding-bottom: 5px">
        Simple KnockoutJs Form:
    </div>
    <div>
        <p>
            First name:
            <input data-bind="value: firstName, valueUpdate: 'keypress'" /></p>
        <p>
            Last name:
            <input data-bind="value: lastName, valueUpdate: 'keypress'" /></p>
    </div>
    <div>
        <h2>
            Hello, <span data-bind="text: fullName"></span>!</h2>
    </div>
</div>

<script language="ecmascript">

    if (typeof jQuery == 'undefined' || typeof ko == 'undefined') {
        var appContainer = document.getElementById('~js-app-id');
        appContainer.innerHTML = "This application requires jQuery and KnockoutJS. Please, make sure jQuery & KnockoutJS libraries are included."
    }
    else {
        $.ajaxSetup({ cache: true });

        jQuery.getScript("~app/app.js?appid=1", function () {
            ko.applyBindings(
                    new knockoutSampleForm.Form("John", "Smith"),
				    document.getElementById('~js-app-id'));

        });

        $.ajaxSetup({ cache: false });
    }

</script>
